<!--
 * @Author: zqx me_zqx@163.com
 * @Date: 2025-08-19 16:33:13
 * @LastEditors: zqx me_zqx@163.com
 * @LastEditTime: 2025-08-28 18:15:56
 * @FilePath: /XMate-h5/src/views/customerAndBusiness/customerDetail/index.vue
 * @Description: 
 * 
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <div class="container">
    <mb />
  </div>
</template>

<script setup>
import mb from "./mb/index.vue";
import { isPC } from "@/utils/platformTool";
import { getLongTimeAgo } from "@/utils/timeTool";
import { computed, onBeforeMount, ref } from "vue";
import { useRoute } from "vue-router";
import { useCustomerStore, useCommonStore } from "@/store";
import { setToken } from "@/utils/auth";
import { getUserInfo } from "@/utils/auth";

const commonStore = useCommonStore();
const route = useRoute();
const store = useCustomerStore();
const defaultTabIndex = ref(0);

const isPc = computed(() => {
  return isPC();
});

onBeforeMount(() => {
  setData();
});

async function setData() {
  const { companyId, customerId, name, st, et, myTeam, dptIds, token } = route.query;

  store.setCurrentCompanyId(companyId);
  store.setCurrentCustomerId(customerId);
  store.setCurrentCompanyName(name);

  const dateRange = getLongTimeAgo();

  store.setStartTime(dateRange.startDate);
  store.setEndTime(dateRange.endDate);
  store.getOuterFiledPartnerAction();

  if (myTeam) {
    store.setMyteam(myTeam);
  } else {
    store.setMyteam(false);
  }
  if (dptIds) {
    store.setDptIds(dptIds);
  }
  if (token) {
    setToken(token);
  }

  await commonStore.getUserInfoAction();
  await commonStore.getFuncpPointsAction();
  await store.getCommunicationStagesAction();
}
</script>

<style lang="less" scoped></style>
